import request from '../../request'
import { AxiosResponse } from 'axios'
import { ResponseData } from "@/types/api/public"
import { CooperativeList } from "@/types/api/tian/dian"
import {cooperative,cooperativeAdd} from "@/types/api/tian/constraint"
type ConfigType<T = ResponseData> = Promise<AxiosResponse<T>>
type querys = {
  name: String,
  page: Number,
  pagesize: Number
}
export const GetCooperativeList = (data: querys): ConfigType<CooperativeList> => {
  return request({
    url: `/hu/cooperative?name=${data.name}&page=${data.page}&pagesize=${data.pagesize}`,
    method: 'get',
    data
  })
}
export const Deletes = (data: String):ConfigType => {
  return request({
    url: `/hu/cooperative/${data}`,
    method: 'delete',
    data
  })
}
export const DataAdd = (data: cooperativeAdd):ConfigType => {
  return request({
    url: `/hu/cooperative`,
    method: 'post',
    data
  })
}
export const DataPut = (data: any,):ConfigType => {
  console.log("data",data);
  return request({
    url: `/hu/cooperative/${data._id}`,
    method: 'put',
    data
  })
}